<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            name: 'xhz',
            age: 18,
            genden: '女',
            scr: function () {
                console.log('爱的打摆子');
                return 11
            }
        }
        console.log(obj.name);
        //obj['age'] 用来解析变量 === obj.age
        console.log(obj['age']);

        let goods = {
            name: '小米10青春版',
            num: '编号158457544',
            weight: '4.5kg',
            address: '中国大陆'

        }
        goods.name = '小米10plus'
        goods.color = 'pink'
        document.write(goods.name,)
        document.write('</br>')
        document.write(goods.num,)
        document.write('</br>')
        document.write(goods.weight,)
        document.write('</br>')
        document.write(goods.address,)
        document.write('</br>')
        document.write(goods.color,)
        document.write('</br>')
        for (let key in goods) {
            document.write(key)
            document.write(goods[key])
        }
        //改变goods对象里面 name属性
        goods.name = 'iphone'
        //删除goods里面的num属性
        delete goods.num
        //新增goods对象里面age属性
        goods.age = 199
        //打印goods对象
        console.log(goods);


        console.log(goods.name, goods.num, goods.weight);
    </script>
</body>

</html>